package com.qianda.qdminiapp.controller.futrue;

import com.qianda.qdminiapp.common.future.CommandFutureManager;
import com.qianda.qdminiapp.controller.Result;
import com.qianda.qdminiapp.domain.dto.FutureDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName FutureController
 * @Author cw
 * @Date 2019/8/8 17:29
 * @Version 1.0
 */
@RestController
@RequestMapping("/remote/v1/commandFuture")
public class FutureController {

    @Autowired
    private CommandFutureManager commandFutureManager;

    /**
     * 命令回复
     *
     * @return 预约赋值
     */
    @PostMapping("/reply")
    public Result appointFuture(@RequestBody  FutureDto futureDto) {

        Map<String,Object> params = new HashMap<>();
        params.put("status",futureDto.getStatus());
        params.put("count",futureDto.getCount());
        params.put("sign",futureDto.getSign());
        commandFutureManager.setResult(futureDto.getFutureId(),params);
        return Result.success();
    }

}
